package utils;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;


public class FileUtils {
	

	public static String readFileAsString(String fullFileName) throws IOException {

		BufferedReader br = new BufferedReader(new FileReader(fullFileName));
		try {
			StringBuilder sb = new StringBuilder();
			String line = br.readLine();

			while (line != null) {
				sb.append(line);
				sb.append(System.lineSeparator());
				line = br.readLine();
			}
			return sb.toString();
		} finally {
			br.close();
		}
	}

	public static void saveFile(String fullFileName, String content) throws IOException {
		BufferedWriter writer = null;
		try {
			writer = new BufferedWriter(new FileWriter(fullFileName));
			writer.write(content);
		} finally {
			writer.close();
		}

	}

}
